﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo
{
    public class TaskExceptionTest
    {
        public async Task<bool> Run()
        {
            var t = RunA();
            return await t;
            //var result = await t;
            //if (t.Exception != null) throw t.Exception;
            //return result;
        }

        public async Task<bool> RunB()
        {
            await Task.Delay(1);
            throw new Exception("error runB");
        }

        public async Task<bool> RunA()
        {
            await Task.Delay(1);
            var t = RunB();
            return await t;
        }
    }
}
